<template>
  <div class="pageW">
    <!-- <el-page-header @back="goBack"></el-page-header> -->

    <el-form :model="form" :rules="rule" ref="form5">
      <div class="titleCommand">
        <div class="l">编辑资料</div>
        <div class="r">
          <el-button class="width120" @click="goBack">取消</el-button>
          <el-button type="primary" class="width120" @click="submit('form5')"
            >提交</el-button
          >
        </div>
      </div>
      <el-card class="box">
        <div class="basic">
          <div class="top">
            <div class="title">基本信息</div>
          </div>
          <div class="bottom">
            <div class="item">
              <el-form-item
                label="所属商户"
                label-position="left"
                label-width="76px"
              >
                <!-- <elMerchantVue
                  v-model="form.parent"
                  :disabled="hasEdit"
                  style="width: 66%"
                ></elMerchantVue> -->
                <el-input
                  v-model="form.parentName"
                  disabled
                  style="width: 66%"
                ></el-input>
              </el-form-item>
            </div>
            <div class="item">
              <el-form-item
                label="商户名称"
                prop="memberName"
                label-position="left"
                label-width="96px"
              >
                <el-input
                  v-model="form.memberName"
                  style="width: 66%"
                  maxlength="50"
                ></el-input>
              </el-form-item>
            </div>
            <div class="item">
              <el-form-item
                label="商户ID"
                label-position="left"
                label-width="76px"
              >
                <el-input
                  v-model="form.memberNo"
                  disabled
                  style="width: 66%"
                ></el-input>
              </el-form-item>
            </div>
            <div class="item">
              <el-form-item
                label="备注"
                label-position="left"
                label-width="76px"
              >
                <el-input
                  v-model="form.remark"
                  style="width: 66%"
                  maxlength="50"
                ></el-input>
              </el-form-item>
            </div>
          </div>
        </div>
      </el-card>
      <el-card class="box">
        <div class="account">
          <div class="top">
            <div class="title">账号信息</div>
          </div>
          <div class="bottom">
            <div class="item">
              <el-form-item
                prop="email"
                label="登录邮箱"
                label-position="left"
                label-width="76px"
              >
                <el-input
                  maxlength="30"
                  v-model="form.email"
                  style="width: 66%"
                  :disabled="form.inviteStatus == 2"
                ></el-input>
                <span style="margin-left: 15px">{{
                  form.inviteStatusName
                }}</span>
              </el-form-item>
            </div>
            <div class="item">
              <el-form-item
                label="允许退款"
                label-position="left"
                label-width="76px"
              >
                <el-switch v-model="form.refundFlag"> </el-switch>
              </el-form-item>
            </div>
          </div>
        </div>
      </el-card>

      <el-card class="box">
        <div class="channel">
          <div class="top">
            <div class="title">支付渠道</div>
          </div>
          <div class="bottom">
            <div class="nav-tab">
              <div
                class="tab-item"
                v-for="(item, index) of channelInfo"
                :key="index"
                :class="curIdx === index ? 'active' : ''"
                @click="changeTab(index)"
              >
                {{ item.name }}
              </div>
            </div>
            <div class="nav-list">
              <div
                class="list-item"
                v-for="(item, index) of channelInfo[curIdx].openList"
                :key="index"
              >
                <div class="tit">{{ item.name }}</div>
                <div class="desc">{{ item.desc }}</div>
                <div class="btn">
                  <el-button
                    type="primary"
                    plain
                    class="width134"
                    @click="openDia1(index)"
                  >
                    {{ !item.whetherComplete ? "填写参数" : "编辑参数" }}
                    <!-- {{
                      Object.keys(item.info).length == 0
                        ? "填写参数"
                        : "编辑参数"
                    }} -->
                  </el-button>
                </div>
              </div>
            </div>
          </div>
        </div>
      </el-card>

      <el-card class="box">
        <div class="payment">
          <div class="top">
            <div class="title">收款账户</div>
          </div>
          <div class="bottom">
            <div class="item" v-for="(item, idx) of accInfo" :key="idx">
              <div class="channel">
                <div class="l">{{ item.name }}</div>
                <div class="r">
                  <!-- <span v-if="Object.keys(item.info).length !== 0">删除</span> -->
                  <span v-if="item.whetherComplete" @click="codeDelAcc(item)"
                    >删除</span
                  >
                  <span v-if="item.whetherComplete" @click="openDia(idx, true)"
                    >详情</span
                  >
                  <span v-if="!item.whetherComplete" @click="codeOpenDia(idx)"
                    >添加</span
                  >
                </div>
              </div>
            </div>
          </div>
        </div>
      </el-card>
    </el-form>

    <el-card class="box">
      <div class="payment">
        <div class="top">
          <div class="title">开发参数</div>
        </div>
        <div class="bottom">
          <div class="param-item">
            <div class="tit">Test Secret Key</div>
            <div class="com">
              <el-input
                placeholder="请输入内容"
                v-model="paramInfo.apiTestSecret"
                disabled
              ></el-input
              >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
              <el-button type="primary" plain @click="openChange(1)"
                >重置</el-button
              >
            </div>
          </div>
          <div class="param-item">
            <div class="tit">Live Secret Key</div>
            <div class="com">
              <el-input
                placeholder="请输入内容"
                v-model="paramInfo.apiLiveSecret"
                disabled
              ></el-input
              >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
              <el-button type="primary" plain @click="openChange(2)"
                >重置</el-button
              >
            </div>
          </div>
          <div class="param-item">
            <div class="tit">云尘付公钥</div>
            <div class="com">
              <el-input
                placeholder="请输入内容"
                v-model="paramInfo.publicKey"
                disabled
                type="textarea"
                :rows="10"
              ></el-input>
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </div>
          </div>
          <div class="param-item">
            <div class="tit">商户 RSA 公钥</div>
            <div class="com">
              <el-input
                placeholder="请输入内容"
                v-model="paramInfo.merchantPublicKey"
                disabled
                type="textarea"
                :rows="10"
              ></el-input>
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
              <el-button
                type="primary"
                plain
                @click="openChange(3)"
                style="height: 32px"
                >编辑</el-button
              >
            </div>
          </div>
        </div>
      </div>
    </el-card>

    <!-- 收款账户 -->
    <el-dialog
      class="cardDialog"
      :show-close="false"
      :visible="accDialog"
      label-width="130px"
      label-position="top"
      width="499px"
      top="30vh"
    >
      <div class="addTitle">
        <span>{{ form1.info ? "查看" : "添加" }}收款账户</span>
      </div>
      <div class="tip">
        此处配置的收款账号可用于订单分润收款和自身余额账户进行提现
      </div>
      <el-form ref="form1" key="a" :rules="rule1" :model="form1">
        <el-form-item prop="radio" label="账号类型" key="radio">
          <el-radio disabled v-model="form1.radio" label="账号类型">{{
            curChannel
          }}</el-radio>
        </el-form-item>

        <el-form-item
          v-if="form1.type == 'ali'"
          prop="ali_account_name"
          label="账号名称"
          key="ali_account_name"
        >
          <el-input v-model="form1.ali_account_name"></el-input>
        </el-form-item>
        <el-form-item
          v-if="form1.type == 'ali'"
          prop="ali_user_id"
          label="支付宝账号"
          key="ali_user_id"
        >
          <el-input v-model="form1.ali_user_id"></el-input>
        </el-form-item>

        <el-form-item
          v-if="form1.type == 'wechat_lite'"
          prop="wechat_lite_account_name"
          label="账号名称"
          key="wechat_lite_account_name"
        >
          <el-input v-model="form1.wechat_lite_account_name"></el-input>
        </el-form-item>
        <el-form-item
          v-if="form1.type == 'wechat_lite'"
          prop="wechat_lite_openid"
          label="个人OpenID/微信商户号"
          key="wechat_lite_openid"
        >
          <el-input v-model="form1.wechat_lite_openid"></el-input>
        </el-form-item>

        <el-form-item
          v-if="form1.type == 'wechat_jsapi'"
          prop="wechat_jsapi_account_name"
          label="账号名称"
          key="wechat_jsapi_account_name"
        >
          <el-input v-model="form1.wechat_jsapi_account_name"></el-input>
        </el-form-item>
        <el-form-item
          v-if="form1.type == 'wechat_jsapi'"
          prop="wechat_jsapi_openid"
          label="个人OpenID/微信商户号"
          key="wechat_jsapi_openid"
        >
          <el-input v-model="form1.wechat_jsapi_openid"></el-input>
        </el-form-item>

        <el-form-item
          v-if="form1.type == 'wechat_app'"
          prop="wechat_app_account_name"
          label="账号名称"
          key="wechat_app_account_name"
        >
          <el-input v-model="form1.wechat_app_account_name"></el-input>
        </el-form-item>
        <el-form-item
          v-if="form1.type == 'wechat_app'"
          prop="wechat_app_openid"
          label="个人OpenID/微信商户号"
          key="wechat_app_openid"
        >
          <el-input v-model="form1.wechat_app_openid"></el-input>
        </el-form-item>
        <el-row :gutter="80">
          <el-col :span="12">
            <el-form-item
              v-if="form1.type == 'ada' || form1.type == 'balance'"
              prop="ada_member_id"
              label="渠道商户ID"
              key="ada_member_id"
            >
              <el-input v-model="form1.ada_member_id"></el-input>
            </el-form-item>
            <div
              class="tip tip1"
              v-if="form1.type == 'ada' || form1.type == 'balance'"
            >
              <a href="#" target="_blank">汇付管理后台-用户管理-查看</a>
            </div>
            <div class="tip tip1" v-if="form1.type == 'ada' && userType == -1">
              <a href="#"
                >还没有商户ID？<span @click="openNewDia" style="color: #03bfc6"
                  >前往获取</span
                ></a
              >
            </div>
          </el-col>
          <el-col :span="12" v-if="getUserInfo().userType.search('main') == -1">
            <el-form-item
              v-if="form1.type == 'ada' || form1.type == 'balance'"
              prop="bankAcctType"
              label="结算银行卡类型"
              key="bankAcctType"
            >
              <el-select
                v-model="form1.bankAcctType"
                placeholder="请选择"
                style="width: 360px"
              >
                <el-option
                  v-for="item of bankTypeList"
                  :key="item.type"
                  :label="item.label"
                  :value="item.type"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="80" v-if="getUserInfo().userType.search('main') == -1">
          <el-col :span="12">
            <el-form-item
              v-if="form1.type == 'ada' || form1.type == 'balance'"
              prop="cardNo"
              label="银行卡号"
              key="cardNo"
            >
              <el-input v-model="form1.cardNo"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item
              v-if="form1.type == 'ada' || form1.type == 'balance'"
              prop="cardName"
              label="开户名称"
              key="cardName"
            >
              <el-input v-model="form1.cardName"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="80" v-if="getUserInfo().userType.search('main') == -1">
          <el-col :span="12">
            <el-form-item
              v-if="form1.type == 'ada' || form1.type == 'balance'"
              prop="bankName"
              label="开户银行"
              key="bankName"
            >
              <el-input v-model="form1.bankName"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-row :gutter="0">
              <el-col :span="12">
                <el-form-item
                  label="银行所在地"
                  prop="provCode"
                  v-if="form1.type == 'ada' || form1.type == 'balance'"
                >
                  <el-select
                    v-model="form1.provCode"
                    placeholder="请选择省"
                    @change="handleProv"
                    style="width: 177px; margin-right: 7px"
                  >
                    <el-option
                      v-for="item of provList"
                      :key="item.id"
                      :label="item.dictLabel"
                      :value="item.dictValue"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item
                  label-width="0"
                  prop="areaCode"
                  v-if="form1.type == 'ada' || form1.type == 'balance'"
                >
                  <el-select
                    v-model="form1.areaCode"
                    placeholder="请选择市"
                    @change="handleArea"
                    style="width: 177px"
                    class="cardNumber"
                  >
                    <el-option
                      v-for="item of cityList"
                      :key="item.id"
                      :label="item.dictLabel"
                      :value="item.dictValue"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
        </el-row>
        <el-row :gutter="80" v-if="getUserInfo().userType.search('main') == -1">
          <el-col :span="12">
            <el-form-item
              v-if="form1.type == 'ada' || form1.type == 'balance'"
              prop="bankNickname"
              label="开户银行支行"
              key="bankNickname"
            >
              <el-input v-model="form1.bankNickname"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item
              v-if="form1.type == 'ada' || form1.type == 'balance'"
              prop="cardTel"
              label="开户行预留手机号"
              key="cardTel"
            >
              <el-input v-model="form1.cardTel"></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-form-item
          v-if="form1.type == 'douyin'"
          prop="douyin_member_id"
          label="渠道商户ID"
          key="douyin_member_id"
        >
          <el-input v-model="form1.douyin_member_id"></el-input>
        </el-form-item>
      </el-form>

      <div slot="footer" class="dialog-footer">
        <el-button @click="cencelReset" class="width120">{{
          dialogType ? "关闭" : "取消"
        }}</el-button>
        <el-button
          class="width120"
          type="primary"
          @click="handleSubmit"
          v-if="!dialogType"
          >提交</el-button
        >
      </div>
    </el-dialog>

    <el-dialog
      class="cardDialog"
      :show-close="false"
      :visible="storeDialog"
      label-width="130px"
      label-position="top"
      width="1095px"
      top="15vh"
    >
      <div class="addTitle">
        <span>获取商户ID</span>
      </div>
      <div class="tip">
        提交信息后需三方审核成功后方可生成商户ID，建议提交信息1-3工作日后再配置支付渠道。
      </div>
      <el-form ref="form3" key="c" :rules="rule3" :model="form3">
        <!-- <div class="store-type-tab mb20">
          <div
            v-for="(name, index) of storeTypeList"
            :key="index"
            class="tab-item"
            :class="storeTabIdx == index ? 'active' : ''"
            @click="changeType(index)"
          >
            {{ name }}
          </div>
        </div> -->
        <!-- <el-row :gutter="80" v-if="storeTabIdx === 0">
          <el-col :span="12">
            <el-form-item prop="name" label="姓名" key="name">
              <el-input v-model="form3.name"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item prop="phone" label="手机号" key="phone">
              <el-input v-model="form3.phone"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-row :gutter="10">
              <el-col :span="8">
                <el-form-item label="证件类型" key="cardType">
                  <el-select v-model="form3.cardType">
                    <el-option label="身份证" value="1"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="16">
                <el-form-item prop="card" key="card">
                  <el-input v-model="form3.card" class="cardNumber"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
        </el-row> -->

        <el-row :gutter="80">
          <el-col :span="12">
            <el-form-item prop="name" label="企业名称" key="name">
              <el-input v-model="form3.name"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-row :gutter="20">
              <el-col :span="11">
                <el-form-item label="经营范围" prop="category_1" key="category">
                  <el-select
                    v-model="form3.category_1"
                    placeholder="请选择一级经营范围"
                    @change="handleCategory"
                    style="width: 208px"
                  >
                    <el-option
                      v-for="item of categoryList1"
                      :key="item.id"
                      :label="item.dictLabel"
                      :value="item.id"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="11">
                <el-form-item label-width="0" prop="category_2">
                  <el-select
                    v-model="form3.category_2"
                    placeholder="请选择二级经营范围"
                    @change="handleCategory1"
                    style="width: 208px"
                    class="cardNumber"
                  >
                    <el-option
                      v-for="item of categoryList2"
                      :key="item.id"
                      :label="item.dictLabel"
                      :value="item.id"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>

          <el-col :span="24">
            <el-row :gutter="0">
              <el-col :span="6">
                <el-form-item label="企业地址" prop="provCode">
                  <el-select
                    v-model="form3.provCode"
                    placeholder="请选择省"
                    @change="handleProv"
                    style="width: 238px; margin-right: 7px"
                  >
                    <el-option
                      v-for="item of provList"
                      :key="item.id"
                      :label="item.dictLabel"
                      :value="item.dictValue"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label-width="0" prop="areaCode">
                  <el-select
                    v-model="form3.areaCode"
                    placeholder="请选择市"
                    @change="handleArea"
                    style="width: 238px; margin-right: 7px"
                    class="cardNumber"
                  >
                    <el-option
                      v-for="item of cityList"
                      :key="item.id"
                      :label="item.dictLabel"
                      :value="item.dictValue"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item prop="address" key="address">
                  <el-input
                    v-model="form3.address"
                    placeholder="请输入"
                    class="cardNumber"
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>

          <el-col :span="12">
            <el-form-item
              prop="socialCreditCode"
              label="统一社会信用码"
              key="socialCreditCode"
            >
              <el-input v-model="form3.socialCreditCode"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item
              prop="socialCreditCodeExpires"
              label="统一社会信用码有效期"
              key="socialCreditCodeExpires"
            >
              <el-date-picker
                clearable
                v-model="form3.socialCreditCodeExpires"
                style="width: 70%; border-radius: 0px; margin-top: 1px"
                class="rightSelect"
                type="daterange"
                value-format="yyyyMMdd"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                range-separator="至"
                :disabled="form3.socialCreditIdLong"
                unlink-panels
              >
              </el-date-picker>
              <el-checkbox
                v-model="form3.socialCreditIdLong"
                :disabled="!form3.socialCreditCodeExpires"
                @change="
                  (val) => longDateChange(val, 'socialCreditCodeExpires')
                "
                style="margin-left: 40px"
                >长期有效</el-checkbox
              >
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item prop="legalPerson" label="法人姓名" key="legalPerson">
              <el-input v-model="form3.legalPerson" maxlength="10"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item prop="legalMp" label="法人电话" key="legalMp">
              <el-input v-model="form3.legalMp"></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item
              prop="legalCertId"
              label="法人身份证号码"
              key="legalCertId"
            >
              <el-input v-model="form3.legalCertId"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item
              prop="legalCertIdExpires"
              label="法人身份证有效期"
              key="legalCertIdExpires"
            >
              <el-date-picker
                clearable
                v-model="form3.legalCertIdExpires"
                style="width: 70%; border-radius: 0px; margin-top: 1px"
                class="rightSelect"
                type="daterange"
                value-format="yyyyMMdd"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                range-separator="至"
                :disabled="form3.legalCertIdLong"
                unlink-panels
              >
              </el-date-picker>
              <el-checkbox
                v-model="form3.legalCertIdLong"
                :disabled="!form3.legalCertIdExpires"
                @change="(val) => longDateChange(val, 'legalCertIdExpires')"
                style="margin-left: 40px"
                >长期有效</el-checkbox
              >
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>

      <div slot="footer" class="dialog-footer">
        <el-button @click="cencelReset2" class="width120">取消</el-button>
        <el-button type="primary" @click="handleSubmit2" class="width120"
          >提交</el-button
        >
      </div>
    </el-dialog>

    <!-- 渠道 -->
    <el-drawer
      :visible="chaDialog"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      :show-close="false"
      size="30%"
    >
      <div class="drawer-wrapper">
        <div class="addTitle mb20">
          <span>{{ curChannel1Name }}</span>
          <img
            v-if="curChannel1 != 'balance'"
            :src="require(`@/assets/imgs/setting/c_${curChannel1}.png`)"
          />
        </div>
        <div class="formWrap">
          <el-form ref="form2" key="b" :rules="rule2" :model="form2">
            <el-form-item
              prop="rate"
              label="渠道费率"
              v-if="
                curCtype !== 'ali_business' &&
                (curChannel1 == 'ali' ||
                  curChannel1 == 'wechat' ||
                  curChannel1 == 'union' ||
                  curChannel1 == 'yse' ||
                  curChannel1 == 'douyin')
              "
              key="rate"
            >
              <el-input
                type="number"
                v-model="form2.rate"
                :step="0.000001"
                oninput="if(isNaN(value)) { value = parseFloat(value) } if(value.indexOf('.')>0){value=value.slice(0,value.indexOf('.')+7)}"
              >
                <template slot="append">%</template>
              </el-input>
            </el-form-item>
            <div
              class="tip tip1"
              v-if="
                curCtype !== 'ali_business' &&
                (curChannel1 == 'ali' || curChannel1 == 'wechat')
              "
            >
              填写你的渠道签约费率，以便计算手续费金额。若不清楚签约费率，请联系支付渠道确认。目前暂不支持阶梯费率计算。
            </div>
            <div class="tip tip1" v-if="curChannel1 == 'union'">
              若签约费率区分借记卡和贷记卡，则该字段默认为借记卡费率。
            </div>
            <el-form-item
              prop="minimum_rate"
              label="最低手续费"
              v-if="curCtype == 'apple_pay' && curChannel1 == 'union'"
              key="minimum_rate"
            >
              <el-input
                title=""
                @keydown.native="inputKeyDown"
                type="number"
                v-model="form2.minimum_rate"
                placeholder="选填"
              >
                <template slot="append">元</template>
              </el-input>
            </el-form-item>
            <div
              class="tip tip1"
              v-if="curCtype == 'apple_pay' && curChannel1 == 'union'"
            >
              若你与渠道签约协议约定了每笔交易的最低手续费，则填写在此。如无特殊约定，无需填写。
            </div>
            <el-form-item
              prop="debit_card_rate"
              label="贷记卡费率"
              v-if="curCtype == 'apple_pay' && curChannel1 == 'union'"
              key="debit_card_rate"
            >
              <el-input
                type="number"
                v-model="form2.debit_card_rate"
                :step="0.000001"
                oninput="if(isNaN(value)) { value = parseFloat(value) } if(value.indexOf('.')>0){value=value.slice(0,value.indexOf('.')+7)}"
                placeholder="选填"
              >
                <template slot="append">%</template>
              </el-input>
            </el-form-item>
            <div
              class="tip tip1"
              v-if="curCtype == 'apple_pay' && curChannel1 == 'union'"
            >
              若签约手续费不区分借记卡和贷记卡，则无需填写。
            </div>
            <el-form-item
              prop="mer_id"
              label="商户号"
              v-if="curChannel1 == 'union'"
              key="mer_id"
            >
              <el-input v-model="form2.mer_id" maxlength="100"></el-input>
            </el-form-item>
            <div class="tip tip1" v-if="curChannel1 == 'union'">
              入网参数信息通知邮件中获取。
            </div>
            <el-form-item
              prop="partner_id"
              label="商户号"
              v-if="curChannel1 == 'yse'"
              key="partner_id"
            >
              <el-input v-model="form2.partner_id" maxlength="100"></el-input>
            </el-form-item>
            <div class="tip tip1" v-if="curChannel1 == 'yse'">
              入网参数信息通知邮件中获取。
            </div>
            <el-form-item
              prop="member_uid"
              label="商户ID"
              v-if="curChannel1 == 'douyin'"
              key="member_uid"
            >
              <el-input v-model="form2.member_uid" maxlength="100"></el-input>
            </el-form-item>
            <div class="tip tip1" v-if="curChannel1 == 'douyin'">
              前往抖音开放平台-我的应用，进入小程序点击
              能力-支付-支付方式管理的进件信息获取。
            </div>
            <el-form-item
              label="安全证书（pfx格式）"
              prop="cover"
              v-if="curChannel1 == 'union'"
            >
              <el-upload
                class="upload-demo"
                action="/merchantApi/oss/upload"
                :headers="{
                  auth_token: getToken(),
                  auth_tmp: curTmp,
                  auth_tck: curTck,
                }"
                :file-list="paymentDocuments1"
                :before-upload="handleBefore1"
                :on-remove="handleRemove1"
                :on-success="handleSuccess1"
              >
                <el-button style="width: 120px" type="primary"
                  >上传文件</el-button
                >
              </el-upload>
            </el-form-item>
            <span class="tipV2" v-if="this.form2.cover">安全证书已上传</span>
            <div
              class="tip tip1"
              v-if="!this.form2.cover && curChannel1 == 'union'"
            >
              在CFCA数字证书下载平台下载并导出包含私钥的安全证书。
            </div>

            <el-form-item
              prop="apple_mer_id"
              label="Apple Merchat ID"
              v-if="curCtype == 'apple_pay' && curChannel1 == 'union'"
              key="apple_mer_id"
            >
              <el-input v-model="form2.apple_mer_id" maxlength="100"></el-input>
            </el-form-item>
            <el-form-item
              prop="middle_cert"
              label="中级证书"
              v-if="curChannel1 == 'union'"
              key="middle_cert"
            >
              <el-input
                maxlength="5500"
                placeholder="中级证书"
                :rows="6"
                type="textarea"
                v-model="form2.middle_cert"
              ></el-input>
            </el-form-item>
            <el-form-item
              prop="root_cert"
              label="根证书"
              v-if="curChannel1 == 'union'"
              key="root_cert"
            >
              <el-input
                maxlength="5500"
                placeholder="根证书"
                :rows="6"
                type="textarea"
                v-model="form2.root_cert"
              ></el-input>
            </el-form-item>
            <el-form-item
              prop="encrypt_cert"
              label="敏感信息加密证书"
              v-if="curCtype == 'unified_pay' && curChannel1 == 'union'"
              key="encrypt_cert"
            >
              <el-input
                maxlength="5500"
                placeholder="敏感信息加密证书"
                :rows="6"
                type="textarea"
                v-model="form2.encrypt_cert"
              ></el-input>
            </el-form-item>
            <el-form-item
              prop="pin_encrypt_cert"
              label="pin敏感信息加密证书"
              v-if="curCtype == 'unified_pay' && curChannel1 == 'union'"
              key="pin_encrypt_cert"
            >
              <el-input
                maxlength="5500"
                placeholder="pin敏感信息加密证书"
                :rows="6"
                type="textarea"
                v-model="form2.pin_encrypt_cert"
              ></el-input>
            </el-form-item>

            <el-form-item
              prop="validate_public_cert"
              label="验签证书"
              v-if="curCtype == 'unified_pay' && curChannel1 == 'union'"
              key="validate_public_cert"
            >
              <el-input
                maxlength="5500"
                placeholder="验签证书"
                :rows="6"
                type="textarea"
                v-model="form2.validate_public_cert"
              ></el-input>
            </el-form-item>

            <el-form-item
              prop="alipay_charset"
              label="编码"
              v-if="curChannel1 == 'ali'"
              key="alipay_charset"
            >
              <el-select
                v-model="form2.alipay_charset"
                placeholder="请选择版本"
                style="width: 100%"
              >
                <!-- <el-option label="mapi" value="mapi"></el-option> -->
                <el-option label="UTF-8" value="UTF-8"></el-option>
              </el-select>
            </el-form-item>
            <div class="tip tip1" v-if="curChannel1 == 'ali'">
              开发者根据实际工程编码配置
            </div>
            <el-form-item
              prop="app_id"
              :label="curChannel1 == 'douyin' ? '小程序App ID' : 'AppID'"
              key="app_id"
              v-if="curChannel1 != 'union' && curChannel1 != 'yse'"
            >
              <el-input v-model="form2.app_id" maxlength="100"></el-input>
            </el-form-item>
            <div class="tip tip1" v-if="curChannel1 == 'wechat'">
              微信生成的应用ID。如公众号场景下，需使用应用属性为公众号的服务AppID
              <!-- <a href="http://www.baidu.com" target="_blank"
                >微信开放平台-管理中心-移动应用-查看</a
              > -->
            </div>
            <div class="tip tip1" v-if="curChannel1 == 'ali'">
              登录 支付宝开放平台 找到对应应用，名称下数字串即为 APPID
            </div>
            <div
              class="tip tip1"
              v-if="curChannel1 == 'ada' || curChannel1 == 'balance'"
            >
              登录 汇付管理后台，进入应用管理查看
            </div>
            <div class="tip tip1" v-if="curChannel1 == 'douyin'">
              前往抖音开放平台-我的应用，进入小程序点击
              能力-支付-支付方式管理中获取。
            </div>
            <el-form-item
              prop="mchid"
              label="微信支付商户号"
              v-if="curChannel1 == 'wechat'"
              key="mchid"
            >
              <el-input v-model="form2.mchid" maxlength="100"></el-input>
            </el-form-item>
            <div class="tip tip1" v-if="curChannel1 == 'wechat'">
              微信支付申请完成之后，在微信商户平台的通知邮件中获取，请确保邮件上的AppID与微信开放平台的AppID一致
            </div>
            <el-form-item
              prop="mer_serial_no"
              label="商户证书序列号"
              v-if="curChannel1 == 'wechat'"
              key="mer_serial_no"
            >
              <el-input
                v-model="form2.mer_serial_no"
                maxlength="100"
              ></el-input>
            </el-form-item>
            <div class="tip tip1" v-if="curChannel1 == 'wechat'">
              前往
              微信商户平台-API安全-API证书-查看证书，可查看商户API证书序列号
            </div>
            <el-form-item
              prop="api_v3_key"
              label="APIV3密钥"
              v-if="curChannel1 == 'wechat'"
              key="api_v3_key"
            >
              <el-input v-model="form2.api_v3_key" maxlength="100"></el-input>
            </el-form-item>
            <div class="tip tip1" v-if="curChannel1 == 'wechat'">
              前往 微信商户平台-API安全-设置密钥，将设置的32位密钥填入
            </div>
            <el-form-item
              prop="api_v2_key"
              label="APIV2密钥(被扫)"
              v-if="curChannel1 == 'wechat' && curCtype == 'wechat_jsapi_pay'"
              key="api_v2_key"
            >
              <el-input v-model="form2.api_v2_key" maxlength="100"></el-input>
            </el-form-item>
            <div
              class="tip tip1"
              v-if="curChannel1 == 'wechat' && curCtype == 'wechat_jsapi_pay'"
            >
              前往 微信商户平台-API安全-设置密钥，将设置的32位密钥填入
            </div>
            <el-form-item
              label="上传V2微信证书(被扫)"
              prop="paymentDocuments"
              v-if="curChannel1 == 'wechat' && curCtype == 'wechat_jsapi_pay'"
            >
              <el-upload
                class="upload-demo"
                action="/merchantApi/oss/upload"
                :headers="{
                  auth_token: getToken(),
                  auth_tmp: curTmp,
                  auth_tck: curTck,
                }"
                :file-list="paymentDocuments"
                :before-upload="handleBefore"
                :on-remove="handleRemove"
                :on-success="handleSuccess"
              >
                <el-button style="width: 120px" type="primary"
                  >上传文件</el-button
                >
              </el-upload>
            </el-form-item>
            <span
              class="tipV2"
              v-if="curV2key && curV2keyType == 'wechat_jsapi_pay'"
              >V2微信证书已上传</span
            >
            <div
              class="tip tip1"
              v-if="curV2keyType == 'wechat_jsapi_pay' && !curV2key"
            >
              <!-- v-if="curChannel1 == 'wechat' && curCtype == 'wechat_jsapi_pay'" -->
              p12格式，用于被扫及红包相关功能。前往
              微信商户平台-API安全-API证书-下载证书
            </div>
            <el-form-item
              prop="api_key"
              label="API Key"
              v-if="curChannel1 == 'ada' || curChannel1 == 'balance'"
              key="api_key"
            >
              <el-input v-model="form2.api_key" maxlength="100"></el-input>
            </el-form-item>
            <div
              class="tip tip1"
              v-if="curChannel1 == 'ada' || curChannel1 == 'balance'"
            >
              登录 汇付管理后台，前往开发-证书管理-查看
            </div>
            <el-form-item
              prop="api_mock_key"
              label="API MockKey"
              v-if="curChannel1 == 'ada' || curChannel1 == 'balance'"
              key="api_mock_key"
            >
              <el-input v-model="form2.api_mock_key" maxlength="100"></el-input>
            </el-form-item>
            <div
              class="tip tip1"
              v-if="curChannel1 == 'ada' || curChannel1 == 'balance'"
            >
              登录 汇付管理后台，前往开发-证书管理-查看
            </div>
            <el-form-item
              prop="rsa_private_key"
              label="商户RSA私钥"
              v-if="curChannel1 == 'ada' || curChannel1 == 'balance'"
              key="rsa_private_key"
            >
              <el-input
                maxlength="5000"
                placeholder="商户RSA私钥"
                :rows="6"
                type="textarea"
                v-model="form2.rsa_private_key"
              ></el-input>
            </el-form-item>
            <div
              class="tip tip1"
              v-if="curChannel1 == 'ada' || curChannel1 == 'balance'"
            >
              登录 汇付管理后台，前往开发-证书管理-查看
            </div>
            <el-form-item
              prop="merchant_public_key"
              label="汇付公钥"
              v-if="curChannel1 == 'ada' || curChannel1 == 'balance'"
              key="merchant_public_key"
            >
              <el-input
                placeholder="汇付公钥"
                :rows="6"
                type="textarea"
                v-model="form2.merchant_public_key"
              ></el-input>
            </el-form-item>
            <div
              class="tip tip1"
              v-if="curChannel1 == 'ada' || curChannel1 == 'balance'"
            >
              登录 汇付管理后台，前往开发-证书管理-查看
            </div>
            <el-form-item
              v-if="curChannel1 == 'ada' || curChannel1 == 'balance'"
              prop="wechat_app_id"
              label="微信AppID"
              key="wechat_app_id"
            >
              <el-input
                v-model="form2.wechat_app_id"
                maxlength="100"
              ></el-input>
            </el-form-item>
            <div
              class="tip tip1"
              v-if="curChannel1 == 'ada' || curChannel1 == 'balance'"
            >
              微信生成的应用ID。如公众号场景下，需使用应用属性为公众号的服务AppID
            </div>
            <el-form-item
              prop="wechat_app_secret"
              label="微信应用密钥"
              v-if="curChannel1 == 'ada' || curChannel1 == 'balance'"
              key="wechat_app_secret"
            >
              <el-input
                maxlength="5000"
                placeholder="微信应用密钥"
                :rows="6"
                type="textarea"
                v-model="form2.wechat_app_secret"
              ></el-input>
            </el-form-item>
            <div
              class="tip tip1"
              v-if="curChannel1 == 'ada' || curChannel1 == 'balance'"
            >
              如果你需要使用云尘付二维码管理功能请填写开发者密码，前往
              微信公众号平台-设置与开发-基本配置-开发者密码（App Secret）
            </div>
            <el-form-item
              prop="merchant_private_key"
              :label="curChannel1 == 'wechat' ? '商户私钥' : '应用私钥'"
              v-if="curChannel1 == 'wechat' || curChannel1 == 'ali'"
              key="merchant_private_key"
            >
              <el-input
                maxlength="5000"
                :placeholder="curChannel1 == 'wechat' ? '商户私钥' : '应用私钥'"
                :rows="6"
                type="textarea"
                v-model="form2.merchant_private_key"
              ></el-input>
            </el-form-item>
            <div class="tip tip1" v-if="curChannel1 == 'wechat'">
              商户申请商户API证书时，会生成商户私钥并保存在本地证书文件夹的pem文件中
            </div>
            <div class="tip tip1" v-if="curChannel1 == 'ali'">
              开发者私钥，由开发者自己生成。
            </div>
            <!-- <el-form-item
              prop="wechat_public_key"
              label="微信平台公钥"
              v-if="curChannel1 == 'wechat'"
              key="wechat_public_key"
            >
              <el-input
                placeholder="微信平台公钥"
                :rows="6"
                type="textarea"
                v-model="form2.wechat_public_key"
              ></el-input>
            </el-form-item> -->
            <el-form-item
              prop="secret"
              label="App secret"
              v-if="curChannel1 == 'douyin'"
              key="secret"
            >
              <el-input placeholder="请输入" v-model="form2.secret"></el-input>
            </el-form-item>
            <div class="tip tip1" v-if="curChannel1 == 'douyin'">
              前往抖音开放平台-我的应用，进入小程序点击 开发-开发配置中获取。
            </div>
            <el-form-item
              prop="salt"
              label="Salt"
              v-if="curChannel1 == 'douyin'"
              key="salt"
            >
              <el-input placeholder="请输入" v-model="form2.salt"></el-input>
            </el-form-item>
            <div class="tip tip1" v-if="curChannel1 == 'douyin'">
              前往抖音开放平台-我的应用，进入小程序点击
              能力-支付-支付方式管理中获取。
            </div>
            <el-form-item
              prop="token"
              label="Token（令牌）"
              v-if="curChannel1 == 'douyin'"
              key="token"
            >
              <el-input placeholder="请输入" v-model="form2.token"></el-input>
            </el-form-item>
            <div class="tip tip1" v-if="curChannel1 == 'douyin'">
              前往抖音开放平台-我的应用，进入小程序点击
              能力-支付-支付方式管理中获取。
            </div>
            <el-form-item
              prop="douyin_public_key"
              label="平台公钥"
              v-if="curChannel1 == 'douyin'"
              key="douyin_public_key"
            >
              <el-input
                maxlength="5000"
                placeholder="请输入"
                :rows="6"
                type="textarea"
                v-model="form2.douyin_public_key"
              ></el-input>
            </el-form-item>
            <div class="tip tip1" v-if="curChannel1 == 'douyin'">
              前往抖音开放平台-我的应用，进入小程序点击 开发-开发配置中获取。
            </div>

            <el-form-item
              prop="app_secret"
              label="应用密钥"
              v-if="curChannel1 == 'wechat' && curCtype == 'wechat_jsapi_pay'"
              key="app_secret"
            >
              <el-input
                maxlength="5000"
                placeholder="应用密钥"
                :rows="6"
                type="textarea"
                v-model="form2.app_secret"
              ></el-input>
            </el-form-item>
            <div
              class="tip tip1"
              v-if="curChannel1 == 'wechat' && curCtype == 'wechat_jsapi_pay'"
            >
              如果你需要使用云尘付二维码管理功能请填写开发者密码，前往
              微信公众号平台-设置与开发-基本配置-开发者密码（App Secret）
            </div>
            <!-- <el-form-item
              prop="wechat_serial_no"
              label="微信平台证书序列号"
              v-if="curChannel1 == 'wechat'"
              key="wechat_serial_no"
            >
              <el-input v-model="form2.wechat_serial_no"></el-input>
            </el-form-item> -->

            <el-form-item
              prop="alipay_public_key"
              label="支付宝公钥"
              v-if="curChannel1 == 'ali' && curCtype !== 'ali_business'"
              key="alipay_public_key"
            >
              <el-input
                maxlength="5000"
                placeholder="请输入公钥"
                :rows="6"
                type="textarea"
                v-model="form2.alipay_public_key"
              ></el-input>
            </el-form-item>
            <div
              class="tip tip1"
              v-if="curChannel1 == 'ali' && curCtype !== 'ali_business'"
            >
              登录支付宝开放平台，进入应用详情页-开发设置-开发信息-接口加签方式（密钥/证书）-点击设置，完成后复制字符串。
            </div>
            <el-form-item
              prop="merchant_public_key"
              label="支付宝公钥证书"
              v-if="curChannel1 == 'ali' && curCtype == 'ali_business'"
              key="merchant_public_key"
            >
              <el-input
                maxlength="5000"
                placeholder="请输入公钥证书"
                :rows="6"
                type="textarea"
                v-model="form2.merchant_public_key"
              ></el-input>
            </el-form-item>
            <div
              class="tip tip1"
              v-if="curChannel1 == 'ali' && curCtype == 'ali_business'"
            >
              转账到支付宝账户必须使用证书加签方式。登录
              支付宝开放平台，进入应用详情页-开发设置-开发信息-接口加签方式（密钥/证书）-点击设置，进入下载页面，查看已配置的支付宝公钥证书。
            </div>
            <el-form-item
              prop="rsa_public_key"
              label="商户应用公钥证书"
              v-if="curChannel1 == 'ali' && curCtype == 'ali_business'"
              key="rsa_public_key"
            >
              <el-input
                maxlength="5000"
                placeholder="请输入商户公钥证书"
                :rows="6"
                type="textarea"
                v-model="form2.rsa_public_key"
              ></el-input>
            </el-form-item>
            <div
              class="tip tip1"
              v-if="curChannel1 == 'ali' && curCtype == 'ali_business'"
            >
              转账到支付宝账户必须使用证书加签方式。登录
              支付宝开放平台，进入应用详情页-开发设置-开发信息-接口加签方式（密钥/证书）-点击设置，进入下载页面，查看已配置的商户应用公钥证书。
            </div>
            <el-form-item
              prop="merchant_root_public_key"
              label="支付宝根证书"
              v-if="curChannel1 == 'ali' && curCtype == 'ali_business'"
              key="merchant_root_public_key"
            >
              <el-input
                maxlength="5500"
                placeholder="请输入支付宝根证书"
                :rows="6"
                type="textarea"
                v-model="form2.merchant_root_public_key"
              ></el-input>
            </el-form-item>
            <div
              class="tip tip1"
              v-if="curChannel1 == 'ali' && curCtype == 'ali_business'"
            >
              转账到支付宝账户必须使用证书加签方式。登录
              支付宝开放平台，进入应用详情页-开发设置-开发信息-接口加签方式（密钥/证书）-点击设置，进入下载页面，查看已配置的支付宝公钥证书。
            </div>
            <el-form-item
              prop="c"
              label="签名类型"
              v-if="curChannel1 == 'ali'"
              key="sign_type"
            >
              <el-select
                v-model="form2.sign_type"
                placeholder="请选择版本"
                style="width: 100%"
              >
                <!-- <el-option label="mapi" value="mapi"></el-option> -->
                <el-option label="RSA2" value="RSA2"></el-option>
              </el-select>
            </el-form-item>
            <div class="tip tip1" v-if="curChannel1 == 'ali'">
              生成签名字符串所使用的签名算法类型，目前支付宝仅支持 RSA2 算法。
            </div>

            <el-form-item
              prop="password"
              label="私钥密码"
              v-if="curChannel1 == 'yse'"
              key="password"
            >
              <el-input v-model="form2.password" maxlength="100"></el-input>
            </el-form-item>
            <el-form-item
              prop="private_key"
              :label="curChannel1 == 'yse' ? '商户RSA私钥' : '应用私钥'"
              v-if="curChannel1 == 'yse' || curChannel1 == 'douyin'"
              key="private_key"
            >
              <el-input
                maxlength="5000"
                placeholder="请输入"
                :rows="6"
                type="textarea"
                v-model="form2.private_key"
              ></el-input>
            </el-form-item>
            <div class="tip tip1" v-if="curChannel1 == 'douyin'">
              前往抖音开放平台-我的应用，进入小程序点击 开发-开发配置中获取。
            </div>

            <el-form-item
              prop="public_key"
              label="银盛公钥"
              v-if="curChannel1 == 'yse'"
              key="public_key"
            >
              <el-input
                maxlength="5000"
                placeholder="银盛公钥"
                :rows="6"
                type="textarea"
                v-model="form2.public_key"
              ></el-input>
            </el-form-item>
            <div class="tip tip1" v-if="curChannel1 == 'yse'">
              安装证书时导出的公钥
            </div>

            <!-- <el-form-item
              label="退款时是否退还支付手续费"
              v-if="
                form2.cType !== 'ali_business' &&
                (curChannel1 == 'ali' || curChannel1 == 'wechat')
              "
              key="refund"
            >
              <el-select v-model="form2.refund" style="width: 100%">
                <el-option label="否" value="0"></el-option>
                <el-option label="是" value="1"></el-option>
              </el-select>
            </el-form-item> -->
            <!-- <el-form-item
              label="微信新资金流"
              v-if="curChannel1 == 'wechat'"
              key="stream"
            >
              <el-select v-model="form2.stream" style="width: 100%">
                <el-option label="否" value="0"></el-option>
                <el-option label="是" value="1"></el-option>
              </el-select>
            </el-form-item> -->
          </el-form>
        </div>
        <!-- <el-scrollbar height="200">
          </el-scrollbar> -->
        <div class="drawer_footer">
          <div>
            <el-button @click="cencelReset1" class="width120">取消</el-button>
            <el-button type="primary" @click="handleSubmit1" class="width120"
              >提交</el-button
            >
          </div>
          <div class="clear" @click="clearData">一键清空数据</div>
        </div>
      </div>
    </el-drawer>

    <!-- 开发参数 -->
    <el-dialog
      class="cardDialog"
      :show-close="false"
      :visible="paramDialog"
      label-width="130px"
      label-position="top"
      width="499px"
      top="5vh"
    >
      <div class="addTitle">
        <span>确认</span>
      </div>
      <div class="tip tip1" v-if="paramType !== 3">
        你即将获得一个新的
        {{
          paramType == 1 ? "Test Secret Key" : "Live Secret Key"
        }}，并且只能用新的
        {{ paramType == 1 ? "Test Secret Key" : "Live Secret Key" }}
        进行支付。
      </div>
      <el-form v-else ref="form4" key="z" :rules="rule4" :model="form4">
        <el-form-item
          prop="merchantPublicKey"
          label="上传商户 RSA 公钥"
          key="merchantPublicKey"
        >
          <el-input
            maxlength="1024"
            placeholder="商户 RSA 公钥"
            :rows="6"
            type="textarea"
            v-model="form4.merchantPublicKey"
          ></el-input>
        </el-form-item>
        <div class="tip tip1">
          上传公钥后，请配置 RSA 私钥到你的代码里。如果已经配置好，请忽略。
        </div>
        <div class="tip tip1">
          <span
            style="color: #03bfc6; cursor: pointer"
            @click="goSearch('如何生成RSA公私钥对')"
            >如何生成 RSA 公私钥对？</span
          ><br />
          <span
            style="color: #03bfc6; cursor: pointer"
            @click="goSearch('如何配置RSA公私钥对')"
            >如何配置 RSA 公私钥对？</span
          >
        </div>
      </el-form>

      <div slot="footer" class="dialog-footer">
        <el-button @click="cencelReset3" class="width120">取消</el-button>
        <el-button type="primary" @click="handleSubmit3" class="width120"
          >提交</el-button
        >
      </div>
    </el-dialog>

    <!-- 安全证书mm -->
    <el-dialog
      class="addDialog"
      title=""
      :visible.sync="addCardDialog"
      width="449px"
      :close-on-click-modal="false"
      :show-close="false"
    >
      <div class="dialogTitle">证书密码验证</div>
      <el-form
        label-position="top"
        :rules="rule5"
        ref="form6"
        :model="form6"
        @submit.native.prevent
      >
        <el-form-item prop="password" label="安全证书密码" key="password">
          <el-input
            v-model="form6.password"
            maxlength="100"
            placeholder="请输入"
          ></el-input>
        </el-form-item>
        <div class="tip tip1">导出安全证书时设置的证书密码。</div>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="resetPassFile" class="width120">取消</el-button>
        <el-button type="primary" class="width120" @click="handleAdd('form6')"
          >确定</el-button
        >
      </div>
    </el-dialog>
    <codeDialogVue
      codeId="1"
      :type="codeType"
      :codeDialog.sync="codeDialog"
      @codeState="codeStateFn"
    />
  </div>
</template>

<script>
// import elMerchantVue from "@/components/el-merchant.vue";
import {
  isCompanyName,
  isPerson,
  isMobile,
  isIdCard,
  isEmail,
  isBankCard
} from "@/utils/validate";
import codeDialogVue from "@/components/codeDialog.vue";
import { getToken, getUserInfo } from "@/utils/public";
import { mapMutations } from "vuex";
import cObj from "@/utils/config";
import crypto from "@/crypto";
import { randomWord } from "@/utils/getRandom";

export default {
  name: "childMerchantEdit",
  components: {
    codeDialogVue,
    // elMerchantVue,
  },
  data() {
    const checkCardNo = (rule, value, callback) => {
      if (isBankCard(value)) {
        callback();
      } else {
        callback(new Error("请输入有效的银行账号"));
      }
    };
    const validateLogo = (rule, value, callback) => {
      if (!this.form2.cover) {
        callback(new Error("请上传安全证书"));
      } else {
        callback();
      }
    };
    const checkEmail = (rule, value, callback) => {
      if (isEmail(value) || value == "" || value == null) {
        callback();
      } else {
        callback(new Error("请输入有效的邮箱地址"));
      }
    };
    const testComName = (rule, value, callback) => {
      if (isCompanyName(value)) {
        callback();
      } else {
        callback(new Error("请输入正确的企业名称"));
      }
    };
    const testName = (rule, value, callback) => {
      if (isPerson(value)) {
        callback();
      } else {
        callback(new Error("请输入正确的姓名"));
      }
    };
    const testPhone = (rule, value, callback) => {
      if (isMobile(value)) {
        callback();
      } else {
        callback(new Error("号码格式不正确"));
      }
    };
    const testID = (rule, value, callback) => {
      if (isIdCard(value)) {
        callback();
      } else {
        callback(new Error("号码格式不正确"));
      }
    };

    return {
      addCardDialog: false,
      cover: null, //银联-安全证书
      form6: {
        password: "",
      }, //动态弹窗
      // certId: null, //银联-安全证书
      curTmp: null,
      curTck: null,
      len: [8, 9, 10, 11, 12][
        Math.floor(Math.random() * [8, 9, 10, 11, 12].length)
      ],
      codeItem: null,
      codeType: "",
      codeDialog: false,
      curV2key: null,
      curV2keyType: null,
      paymentDocuments: [], // 付款文件
      paymentDocuments1: [],
      categoryList1: [], // 一级经营范围
      categoryList2: [], // 二级经营范围
      provList: [],
      cityList: [],
      storeTypeList: ["个人用户", "企业用户"],
      dialogType: false,
      curChannel: "支付宝",
      curChannel1: "ali",
      curChannel1Name: "支付宝 App 支付",
      accDialog: false,
      curIdx: 0,
      curCtype: "",
      accInfo: [
        {
          channel: "ali",
          name: "支付宝",
          info: {
            name: "ronnie",
            number: "test123",
          },
        },
        {
          channel: "wechatApp",
          name: "微信 APP",
          info: {},
        },
        {
          channel: "wechatJsApi",
          name: "微信 JSAPI 支付",
          info: {},
        },
        {
          channel: "wechatSmall",
          name: "微信小程序",
          info: {},
        },
        {
          channel: "ada", //汇付
          name: "汇付支付",
          info: {},
        },
      ],
      form1: {
        radio: "账号类型",
      }, //动态弹窗
      chaDialog: false,
      channelInfo: [
        {
          channel: "ali",
          name: "支付宝",
          openList: [
            {
              type: 1,
              name: "支付宝 App 支付",
              desc: "APP/分期",
              info: {},
            },
            {
              type: 2,
              name: "支付宝小程序支付",
              desc: "支付宝小程序",
              info: {},
            },
            {
              type: 3,
              name: "支付宝电脑网站支付",
              desc: "PC/分期",
              info: {},
            },
            {
              type: 4,
              name: "支付宝当面付",
              desc: "用户主扫/用户被扫/分期",
              info: {},
            },
            {
              type: 5,
              name: "支付宝手机网站支付",
              desc: "WAP/分期",
              info: {},
            },
          ],
        },
        {
          channel: "wechat",
          name: "微信",
          openList: [
            {
              type: 1,
              name: "微信 App 支付",
              desc: "APP/企业付款",
              info: {},
            },
            {
              type: 2,
              name: "微信小程序支付",
              desc: "微信小程序/企业付款",
              info: {},
            },
            {
              type: 3,
              name: "微信 JSAPI 支付",
              desc: "公众号/扫码/企业付款/红包",
              info: {},
            },
            {
              type: 4,
              name: "微信 H5 支付",
              desc: "WAP",
              info: {},
            },
          ],
        },
        {
          channel: "ada",
          name: "其他",
          openList: [
            {
              type: 1,
              name: "汇付支付",
              desc: "WAP/PC/H5/APP/企业付款/小程序/扫码",
              info: {},
            },
          ],
        },
      ],
      form2: {
        cover: null,
        alipay_charset: "UTF-8",
        sign_type: "RSA2",
        // refund: "0",
        // stream: "0",
      }, //动态弹窗
      storeDialog: false,
      form3: {
        // cardType: "1",
      }, //动态弹窗
      rule: {
        memberName: [
          { required: true, message: "请输入商户名称", trigger: "change" },
        ],
        email: [{ validator: checkEmail, trigger: "change" }],
      },
      rule1: {
        // radio: [{ required: true }],
        ali_account_name: [
          { required: true, message: "请输入账户名称", trigger: "change" },
          { max: 64, message: "最大长度64字符", trigger: "change" },
          {
            pattern: /^(?!\s+).*(?<!\s)$/,
            message: "格式有误",
            trigger: "change",
          },
        ],
        wechat_lite_account_name: [
          { required: true, message: "请输入账户名称", trigger: "change" },
          { max: 64, message: "最大长度64字符", trigger: "change" },
          {
            pattern: /^(?!\s+).*(?<!\s)$/,
            message: "格式有误",
            trigger: "change",
          },
        ],
        wechat_jsapi_account_name: [
          { required: true, message: "请输入账户名称", trigger: "change" },
          { max: 64, message: "最大长度64字符", trigger: "change" },
          {
            pattern: /^(?!\s+).*(?<!\s)$/,
            message: "格式有误",
            trigger: "change",
          },
        ],
        wechat_app_account_name: [
          { required: true, message: "请输入账户名称", trigger: "change" },
          { max: 64, message: "最大长度64字符", trigger: "change" },
          {
            pattern: /^(?!\s+).*(?<!\s)$/,
            message: "格式有误",
            trigger: "change",
          },
        ],
        ali_member_id: [
          { required: true, message: "请输入账户", trigger: "change" },
          { max: 64, message: "最大长度64字符", trigger: "change" },
          {
            pattern: /^(?!\s+).*(?<!\s)$/,
            message: "格式有误",
            trigger: "change",
          },
        ],
        wechat_lite_member_id: [
          { required: true, message: "请输入OpenId", trigger: "change" },
          { max: 64, message: "最大长度64字符", trigger: "change" },
          {
            pattern: /^(?!\s+).*(?<!\s)$/,
            message: "格式有误",
            trigger: "change",
          },
        ],
        wechat_jsapi_member_id: [
          { required: true, message: "请输入OpenId", trigger: "change" },
          { max: 64, message: "最大长度64字符", trigger: "change" },
          {
            pattern: /^(?!\s+).*(?<!\s)$/,
            message: "格式有误",
            trigger: "change",
          },
        ],
        wechat_app_member_id: [
          { required: true, message: "请输入OpenId", trigger: "change" },
          { max: 64, message: "最大长度64字符", trigger: "change" },
          {
            pattern: /^(?!\s+).*(?<!\s)$/,
            message: "格式有误",
            trigger: "change",
          },
        ],
        bankAcctType: [
          { required: true, message: "请选择银行卡类型", trigger: "change" },
        ],
        cardNo: [
          { required: true, message: "请输入银行卡号", trigger: "change" },
          {
            validator: checkCardNo,
            trigger: "change",
          },
        ],
        cardName: [
          { required: true, message: "请输入开户名称", trigger: "change" },
        ],
        bankName: [
          { required: true, message: "请输入开户银行", trigger: "change" },
        ],
        bankNickname: [
          { required: true, message: "请输入开户银行支行", trigger: "change" },
        ],
        cardTel: [
          { required: true, message: "请输入预留手机号", trigger: "change" },
        ],

        ada_member_id: [
          { required: true, message: "请输入渠道商户ID", trigger: "change" },
          { max: 64, message: "最大长度64字符", trigger: "change" },
          {
            pattern: /^(?!\s+).*(?<!\s)$/,
            message: "格式有误",
            trigger: "change",
          },
        ],
      },
      rule2: {
        rate: [
          { required: true, message: "请输入渠道费率", trigger: "change" },
          { validator: this.checkAmount, trigger: "change" },
        ],
        cover: [{ required: true, validator: validateLogo, trigger: "change" }],
        debit_card_rate: [{ validator: this.checkAmount2, trigger: "change" }],
        password: [
          {
            required: true,
            message: "私钥密码 必填",
            trigger: "change",
          },
          {
            pattern: /^(?!\s+).*(?<!\s)$/,
            message: "格式有误",
            trigger: "change",
          },
        ],
        minimum_rate: [
          {
            validator: this.checkAmount1,
            trigger: "change",
          },
        ],
        // version: [{ required: true, message: "请选择版本", trigger: "change" }],
        app_id: [
          {
            required: true,
            message: "App ID 必填",
            trigger: "change",
          },
          {
            pattern: /^(?!\s+).*(?<!\s)$/,
            message: "格式有误",
            trigger: "change",
          },
        ],
        mchid: [
          {
            required: true,
            message: "商户号 必填",
            trigger: "change",
          },
          {
            pattern: /^(?!\s+).*(?<!\s)$/,
            message: "格式有误",
            trigger: "change",
          },
        ],
        mer_id: [
          {
            required: true,
            message: "商户号 必填",
            trigger: "change",
          },
          {
            pattern: /^(?!\s+).*(?<!\s)$/,
            message: "格式有误",
            trigger: "change",
          },
        ],
        member_uid: [
          {
            required: true,
            message: "商户ID 必填",
            trigger: "change",
          },
          {
            pattern: /^(?!\s+).*(?<!\s)$/,
            message: "格式有误",
            trigger: "change",
          },
        ],
        partner_id: [
          {
            required: true,
            message: "商户号 必填",
            trigger: "change",
          },
          {
            pattern: /^(?!\s+).*(?<!\s)$/,
            message: "格式有误",
            trigger: "change",
          },
        ],
        apple_mer_id: [
          {
            required: true,
            message: "Apple Merchat ID 必填",
            trigger: "change",
          },
          {
            pattern: /^(?!\s+).*(?<!\s)$/,
            message: "格式有误",
            trigger: "change",
          },
        ],
        mer_serial_no: [
          {
            required: true,
            message: "商户证书序列号 必填",
            trigger: "change",
          },
          {
            pattern: /^(?!\s+).*(?<!\s)$/,
            message: "格式有误",
            trigger: "change",
          },
        ],
        api_v3_key: [
          {
            required: true,
            message: "apiV3密钥 必填",
            trigger: "change",
          },
          {
            pattern: /^(?!\s+).*(?<!\s)$/,
            message: "格式有误",
            trigger: "change",
          },
        ],
        // wechat_serial_no: [
        //   {
        //     required: true,
        //     message: "微信平台证书序列号 必填",
        //     trigger: "change",
        //   },
        //   {
        //     pattern: /^(?!\s+).*(?<!\s)$/,
        //     message: "格式有误",
        //     trigger: "change",
        //   },
        // ],
        rsa_private_key: [
          {
            required: true,
            message: "RSA 私钥 必填",
            trigger: "change",
          },
        ],
        private_key: [
          {
            required: true,
            message: "请输入私钥",
            trigger: "change",
          },
        ],
        public_key: [
          {
            required: true,
            message: "银盛公钥 必填",
            trigger: "change",
          },
        ],
        // merchant_public_key: [
        //   {
        //     required: true,
        //     message: "汇付 公钥 必填",
        //     trigger: "change",
        //   },
        // ],
        merchant_private_key: [
          {
            required: true,
            message: "商户私钥 必填",
            trigger: "change",
          },
        ],
        // wechat_public_key: [
        //   {
        //     required: true,
        //     message: "微信平台公钥 必填",
        //     trigger: "change",
        //   },
        // ],
        api_key: [
          {
            required: true,
            message: "API 密钥 必填",
            trigger: "change",
          },
          {
            pattern: /^(?!\s+).*(?<!\s)$/,
            message: "格式有误",
            trigger: "change",
          },
        ],
        api_mock_key: [
          {
            required: true,
            message: "API MockKey 必填",
            trigger: "change",
          },
          {
            pattern: /^(?!\s+).*(?<!\s)$/,
            message: "格式有误",
            trigger: "change",
          },
        ],
        alipay_public_key: [
          {
            required: true,
            message: "请输入公钥",
            trigger: "change",
          },
        ],
        secret: [
          {
            required: true,
            message: "请输入App secret",
            trigger: "change",
          },
        ],
        salt: [
          {
            required: true,
            message: "请输入Salt",
            trigger: "change",
          },
        ],
        token: [
          {
            required: true,
            message: "请输入Token令牌",
            trigger: "change",
          },
        ],
        douyin_public_key: [
          {
            required: true,
            message: "请输入平台公钥",
            trigger: "change",
          },
        ],

        merchant_public_key: [
          {
            required: true,
            message: "请输入公钥",
            trigger: "change",
          },
        ],
        rsa_public_key: [
          {
            required: true,
            message: "请输入商户公钥证书",
            trigger: "change",
          },
        ],
        merchant_root_public_key: [
          {
            required: true,
            message: "请输入支付宝根证书",
            trigger: "change",
          },
        ],
        middle_cert: [
          {
            required: true,
            message: "请输入中级证书",
            trigger: "change",
          },
        ],
        encrypt_cert: [
          {
            required: true,
            message: "请输入敏感信息加密证书",
            trigger: "change",
          },
        ],
        pin_encrypt_cert: [
          {
            required: true,
            message: "请输入pin敏感信息加密证书",
            trigger: "change",
          },
        ],
        validate_public_cert: [
          {
            required: true,
            message: "请输入验签证书",
            trigger: "change",
          },
        ],
        root_cert: [
          {
            required: true,
            message: "请输入根证书",
            trigger: "change",
          },
        ],
      },
      rule3: {
        // name: [{ required: true, message: "请输入姓名", trigger: "change" }],
        // phone: [{ required: true, message: "请输入手机", trigger: "change" }],
        // card: [{ required: true, message: "请输入号码", trigger: "change" }],
        name: [
          { required: true, message: "请输入企业名称", trigger: "change" },
          { max: 60, message: "最大长度60字符", trigger: "change" },
          {
            pattern: /^(?!\s+).*(?<!\s)$/,
            message: "格式有误",
            trigger: "change",
          },
          {
            validator: testComName,
            trigger: "change",
          },
        ],
        category_1: [
          { required: true, message: "请选择经营范围", trigger: "change" },
        ],
        category_2: [
          { required: true, message: "请选择经营范围", trigger: "change" },
        ],
        provCode: [{ required: true, message: "请选择省", trigger: "change" }],
        areaCode: [{ required: true, message: "请选择市", trigger: "change" }],
        address: [
          { required: true, message: "请输入地址", trigger: "change" },
          {
            pattern: /^(?!\s+).*(?<!\s)$/,
            message: "格式有误",
            trigger: "change",
          },
        ],
        socialCreditCode: [
          {
            required: true,
            message: "请输入统一社会信用码",
            trigger: "change",
          },
          {
            pattern: /^(?!\s+).*(?<!\s)$/,
            message: "格式有误",
            trigger: "change",
          },
        ],
        socialCreditCodeExpires: [
          { required: true, message: "请选择有效期", trigger: "change" },
        ],
        legalCertIdExpires: [
          { required: true, message: "请选择有效期", trigger: "change" },
        ],
        legalPerson: [
          { required: true, message: "请输入法人姓名", trigger: "change" },
          { max: 10, message: "最大长度10字符", trigger: "change" },
          {
            pattern: /^(?!\s+).*(?<!\s)$/,
            message: "格式有误",
            trigger: "change",
          },
          {
            validator: testName,
            trigger: "change",
          },
        ],
        legalMp: [
          { required: true, message: "请输入电话", trigger: "change" },
          {
            pattern: /^(?!\s+).*(?<!\s)$/,
            message: "格式有误",
            trigger: "change",
          },
          {
            validator: testPhone,
            trigger: "change",
          },
        ],
        legalCertId: [
          { required: true, message: "请输入身份证", trigger: "change" },
          {
            pattern: /^(?!\s+).*(?<!\s)$/,
            message: "格式有误",
            trigger: "change",
          },
          {
            validator: testID,
            trigger: "change",
          },
        ],
      },
      rule4: {
        merchantPublicKey: [
          { required: true, message: "请输入公钥", trigger: "change" },
        ],
      },
      rule5: {
        password: [
          {
            required: true,
            message: "安全证书密码 必填",
            trigger: "change",
          },
          {
            pattern: /^(?!\s+).*(?<!\s)$/,
            message: "格式有误",
            trigger: "change",
          },
        ],
      },
      form4: {
        merchantPublicKey: "",
      },
      page: 1,
      value1: "",
      value2: false,
      form: { parent: [], email: "" },
      hasEdit: false,
      storeTabIdx: 0,

      paramInfo: {
        apiTestSecret: "sk_test_fv9Ga9nf5u14H0CuX9HivzXH",
        apiLiveSecret: "sk_live_0GCO44O4m1CCOyDeH0irPGOS",
        publicKey: `-----BEGIN PUBLIC KEY-----
        MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtV/0qEOUBOm+JoQKz4bQ
        W0JqQT3mu3CRGo2CzqeLQyFSCw9uLci/VqwQQXzIleCBd+zj7rFM9mMu8qYjKzKO
        gFEL15DyVAZcNcJ0kVenO3Da6Pqypsov6UDDOreIU18YV+tH2OY2G6yjyGyML0g/
        Rvl8Osfta8R9P23SOIyXuaAE15A7f5H3m6cTeb1IfIxINwg2zmE2c7dlKHKHFXe5
        spNpn8sdmtRgJSuMZo1t/mzR7hFYV0lFMRDH/Xb7GlZubEVUGoFGXgiCcbH7qTdZ
        ghrHGKNDkDllc7kRGWEdvA7LLU7VThOoiNC4oG36ayaqee9qSD0h/VaC6qj03S+9
        qwIDAQAB
        -----END PUBLIC KEY-----`,
        merchantPublicKey: `-----BEGIN PUBLIC KEY-----
        MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtV/0qEOUBOm+JoQKz4bQ
        W0JqQT3mu3CRGo2CzqeLQyFSCw9uLci/VqwQQXzIleCBd+zj7rFM9mMu8qYjKzKO
        gFEL15DyVAZcNcJ0kVenO3Da6Pqypsov6UDDOreIU18YV+tH2OY2G6yjyGyML0g/
        Rvl8Osfta8R9P23SOIyXuaAE15A7f5H3m6cTeb1IfIxINwg2zmE2c7dlKHKHFXe5
        spNpn8sdmtRgJSuMZo1t/mzR7hFYV0lFMRDH/Xb7GlZubEVUGoFGXgiCcbH7qTdZ
        ghrHGKNDkDllc7kRGWEdvA7LLU7VThOoiNC4oG36ayaqee9qSD0h/VaC6qj03S+9
        qwIDAQAB
        -----END PUBLIC KEY-----`,
      },
      paramType: 1,
      paramDialog: false,
      memberId: "",
    };
  },
  created() {
    this.curTmp = new Date().getTime();
    this.curTck = crypto.set(
      getToken() + "_" + this.curTmp + "_" + randomWord(this.len),
      "a1g0qoalvv19aed3"
    );

    const id = this.$route.query.id;
    if (id) {
      this.getMemberbase(id); //获取子商户基本信息
      this.getChannelList(id); //获取渠道
      this.getAccList(id); //获取账户
      this.getParamsInfo(id); //获取开发参数

      this.getProvinceInfo(); //获取省市信息
      this.getBusinessNature(); //获取经营范围
      this.hasEdit = true;
      this.memberId = id;
    }
  },
  watch: {
    "$store.state.testLine": {
      handler() {
        if (this.$route.name == this.$options.name) {
          const id = this.$route.query.id;
          if (id) {
            this.getMemberbase(id); //获取子商户基本信息
            this.getChannelList(id); //获取渠道
            this.getAccList(id); //获取账户
            this.getParamsInfo(id); //获取开发参数

            this.getProvinceInfo(); //获取省市信息
            this.getBusinessNature(); //获取经营范围
            this.hasEdit = true;
            this.memberId = id;
          }
        }
      },
    },
    deep: true,
  },
  methods: {
    ...mapMutations(["changeLive"]),
    getToken,
    getUserInfo,
    clearData() {
      this.paymentDocuments = [];
      this.paymentDocuments1 = []; // 付款文件
      this.form2 = {};
      this.$refs["form2"].resetFields();
      if (this.curChannel1 == "ali") {
        this.form2.alipay_charset = "UTF-8";
        this.form2.sign_type = "RSA2";
      }
      this.$nextTick(() => {
        this.$refs.form2.clearValidate();
      });
    },
    resetPassFile() {
      this.paymentDocuments1 = [];
      this.form2.paymentDocuments1 = [];
      this.addCardDialog = false;
      this.form6.password = "";
    },
    handleAdd(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.submitFile1();
        } else {
          return false;
        }
      });
    },
    codeStateFn(val) {
      if (val) {
        if (this.codeType == "SMS_BUSINESS_EDIT_SUB_CHANNEL_PARAM") {
          this.handleSubmit11();
        } else if (this.codeType == "SMS_BUSINESS_ADD_SUB_COLLECTION_ACCOUNT") {
          this.openDia(this.codeItem, false);
        } else if (
          this.codeType == "SMS_BUSINESS_DELETE_SUB_COLLECTION_ACCOUNT"
        ) {
          this.delAcc(this.codeItem);
        } else if (
          this.codeType == "SMS_BUSINESS_EDIT_TEST_SECRET_KEY" ||
          this.codeType == "SMS_BUSINESS_EDIT_LIVE_SECRET_KEY" ||
          this.codeType == "SMS_BUSINESS_EDIT_MERCHANT_RSA_PUBLIC_KEY"
        ) {
          this.paramDialog = true;
        }
      }
    },
    goSearch(val) {
      window.open(`${cObj.websiteUrl}helpResult?issue=${val}`);
    },
    checkAmount(rule, value, callback) {
      //console.log(value);
      if (!value) {
        callback(new Error("请输入渠道费率"));
      } else if (Number(value) > 100) {
        callback(new Error("渠道费率不能大于100%"));
      } else if (Number(value) < 0) {
        callback(new Error("渠道费率不能小于0%"));
      } else {
        callback();
      }
    },
    longDateChange(val, prop) {
      //console.log(val);
      //console.log(prop);
      this[`${prop}End`] = this.form3[prop][1];

      if (val) {
        this.$set(this.form3, prop, [this.form3[prop][0], "20991231"]);
      } else {
        this.$set(this.form3, prop, [this.form3[prop][0], this[`${prop}End`]]);
      }
      //console.log(this.form3);
    },
    // 获取开发参数列表
    getParamsInfo(memberId) {
      // var params = new FormData();
      // params.append("memberId", memberId);
      let params = {
        memberId,
      };
      this.$http
        .post("/api/developparam/listMerchantSecret", params)
        .then((res) => {
          if (res.code === "0000") {
            //console.log(res.data);
            this.paramInfo = res.data || {};
            this.form4.merchantPublicKey = res.data.merchantPublicKey;
          }
        });
    },
    //修改开发参数
    openChange(type) {
      if (getUserInfo().checkFlag) {
        this.paramType = type;
        this.paramDialog = true;
      } else {
        this.paramType = type;
        this.codeDialog = true;
        if (type == 1) {
          this.codeType = "SMS_BUSINESS_EDIT_TEST_SECRET_KEY";
        } else if (type == 2) {
          this.codeType = "SMS_BUSINESS_EDIT_LIVE_SECRET_KEY";
        } else if (type == 3) {
          this.codeType = "SMS_BUSINESS_EDIT_MERCHANT_RSA_PUBLIC_KEY";
        }
      }
    },
    getProvinceInfo() {
      // 省
      this.$http
        .get(
          "/dictdata/getByDictTypeAndPid?dictType=ada_bank_province_city&parentId=1"
        )
        .then((res) => {
          if (res.code === "0000") {
            this.provList = res.data;
          }
        });
    },
    getBusinessNature() {
      // 经营范围
      this.$http
        .get("dictdata/getByDictTypeAndPid?dictType=business_type&parentId=0")
        .then((res) => {
          if (res.code === "0000") {
            this.categoryList1 = res.data;
            //console.log(res.data);
          }
        });
    },
    handleCategory(val) {
      if (this.form3.category_2) this.form3.category_2 = "";
      this.getSecondCate(val);
      let item = this.categoryList1.find((item) => item.id == val);
      this.form3.category_1_name = item.dictLabel;
      //console.log(this.form3);
    },
    // 获取二级经营范围
    getSecondCate(val) {
      this.$http
        .get(
          `dictdata/getByDictTypeAndPid?dictType=business_type&parentId=${val}`
        )
        .then((res) => {
          if (res.code === "0000") {
            this.categoryList2 = res.data;
          }
        });
    },
    handleCategory1(val) {
      this.$set(this.form3, this.form3.category_2, val);
      let item = this.categoryList2.find((item) => item.id == val);
      this.form3.category_2_name = item.dictLabel;
      //console.log(this.form3);
    },
    handleProv(val) {
      // this.$refs.form.validate();
      this.$set(this.form3, "areaCode", "");
      this.$http
        .get(
          `/dictdata/getByDictTypeAndPid?dictType=ada_bank_province_city&parentId=${val}`
        )
        .then((res) => {
          if (res.code === "0000") {
            this.cityList = res.data;
          }
        });
    },
    handleArea(val) {
      this.$set(this.form3, this.form3.areaCode, val);
    },
    getAccList(id) {
      this.$http
        .get(`/api/sub/member/base/channel/account/list?memberId=${id}`)
        .then((res) => {
          if (res.code === "0000") {
            //console.log(res.data);
            this.accInfo = res.data;
          }
        });
    },
    getMemberbase(id) {
      this.$http.get(`/api/merchant/memberbase/get?id=${id}`).then((res) => {
        if (res.code === "0000") {
          //console.log(res.data);
          this.form = res.data;
          this.form.parent = [res.data.parentId];
        }
      });
    },
    getChannelList(id) {
      this.$http
        .get(`/api/sub/member/base/channel/param/list?memberId=${id}`)
        .then((res) => {
          if (res.code === "0000") {
            //console.log(res.data);
            this.channelInfo = res.data;
          }
        });
    },
    codeDelAcc(val) {
      if (getUserInfo().checkFlag) {
        this.delAcc(val);
      } else {
        this.codeItem = val;
        this.codeDialog = true;
        this.codeType = "SMS_BUSINESS_DELETE_SUB_COLLECTION_ACCOUNT";
      }
    },
    delAcc(item) {
      let param = {
        channel: item.type,
        // combineTypes: item.combineTypes,
        memberId: this.$route.query.id,
      };
      //console.log(param);

      this.$http
        .post(`/api/sub/member/base/channel/account/unbind`, param)
        .then((res) => {
          if (res.code === "0000") {
            this.$message.success(res.msg);
            this.getAccList(this.$route.query.id); //获取账户
          }
        });
    },
    openNewDia() {
      this.form3 = {};
      this.form3.socialCreditIdLong = false;
      this.form3.legalCertIdLong = false;
      let a = setTimeout(() => {
        this.cencelReset(); //关闭现有弹窗
        this.storeDialog = true;
        this.$refs.form3.clearValidate();
        clearTimeout(a);
      }, 0);
    },
    codeOpenDia(val) {
      if (getUserInfo().checkFlag) {
        this.openDia(val, false);
      } else {
        this.codeItem = val;
        this.codeDialog = true;
        this.codeType = "SMS_BUSINESS_ADD_SUB_COLLECTION_ACCOUNT";
      }
    },
    openDia(idx, type) {
      this.form1 = {
        ...this.form1,
        ...this.accInfo[idx].info,
        type: this.accInfo[idx].type,
        //后台需要参数
        channel: this.accInfo[idx].type,
        info: this.accInfo[idx].info,
        // combineTypes: this.accInfo[idx].combineTypes,
      };
      this.curChannel = this.accInfo[idx].name;
      //console.log(this.form1);
      this.dialogType = type;
      this.accDialog = true;
    },
    cencelReset() {
      this.$refs.form1.resetFields(); //重置状态
      this.form1 = {
        radio: "账号类型",
      }; //重置状态
      //console.log(this.form1);
      this.accDialog = false;
    },
    handleBefore(file) {
      const is2M = file.size / 1024 / 1024 < 2;
      //console.log(file.name);
      if (!file.name.includes("p12") && !file.name.includes("p12")) {
        this.$message.warning("只支持p12格式");
        return false;
      }
      if (!is2M) {
        this.$message.warning("上传文件大小不能超过2M");
        return false;
      }
      return true;
    },
    handleBefore1(file) {
      const is2M = file.size / 1024 / 1024 < 2;
      if (!file.name.includes("pfx") && !file.name.includes("pfx")) {
        this.$message.warning("只支持pfx格式");
        return false;
      }
      if (!is2M) {
        this.$message.warning("上传文件大小不能超过2M");
        return false;
      }
      return true;
    },
    handleRemove() {
      this.paymentDocuments = [];
      this.form2.paymentDocuments = undefined;
    },
    handleRemove1() {
      this.paymentDocuments1 = [];
      this.form2.paymentDocuments1 = undefined;
      this.form2.cover = "";
    },
    handleSuccess(res, file) {
      //console.log(file);
      this.paymentDocuments = [];
      this.paymentDocuments = [file.raw];
      this.form2.paymentDocuments = file.raw;
      this.submitFile();
      // this.$nextTick(() => {
      //   this.$refs.form.clearValidate();
      // });
    },
    handleSuccess1(res, file) {
      this.paymentDocuments1 = [];
      this.paymentDocuments1 = [file.raw];
      this.form2.paymentDocuments1 = file.raw;
      this.$nextTick(() => {
        this.$refs.form2.clearValidate(["cover"]);
      });
      this.addCardDialog = true;
    },
    submitFile1() {
      var params = new FormData();
      params.append("memberId", this.$route.query.id);
      params.append("file", this.form2.paymentDocuments1);
      params.append("payType", this.curCtype);

      params.append("password", this.form6.password);
      this.$http
        .post("/api/sub/member/base/saveUnionCert", params)
        .then((res) => {
          if (res.code === "0000") {
            this.addCardDialog = false;
            this.form2.cover = res.data;
            this.$message.success("上传成功！");
          }
        });
    },
    submitFile() {
      var params = new FormData();
      params.append("memberId", this.$route.query.id);
      params.append("file", this.form2.paymentDocuments);
      this.$http
        .post("/api/sub/member/base/saveWechatV2Cert", params)
        .then((res) => {
          if (res.code === "0000") {
            //console.log(res.data);
            this.$message.success("文件上传成功！");
          }
        });
    },
    handleSubmit() {
      this.$refs.form1.validate((valid) => {
        if (valid) {
          var info = {};
          switch (this.form1.type) {
            case "ali":
              info.ali_account_name = this.form1.ali_account_name;
              info.ali_user_id = this.form1.ali_member_id;
              break;
            case "ada":
              info.ada_member_id = this.form1.ada_member_id;
              break;
            case "douyin":
              info.douyin_merchant_uid = this.form1.douyin_member_id;
              break;
            case "wechat_lite":
              info.wechat_lite_account_name =
                this.form1.wechat_lite_account_name;
              info.wechat_lite_openid = this.form1.wechat_lite_member_id;
              break;
            case "wechat_jsapi":
              info.wechat_jsapi_account_name =
                this.form1.wechat_jsapi_account_name;
              info.wechat_jsapi_openid = this.form1.wechat_jsapi_member_id;
              break;
            case "wechat_app":
              info.wechat_app_account_name = this.form1.wechat_app_account_name;
              info.wechat_app_openid = this.form1.wechat_app_member_id;
              break;
            default:
              break;
          }
          let param = {
            ...this.form1,
            memberId: this.$route.query.id,
            info,
          };
          //console.log(param);
          this.$http
            .post(`/api/sub/member/base/channel/account/bind`, param)
            .then((res) => {
              if (res.code === "0000") {
                this.$message.success(res.msg);
                this.cencelReset();
                this.getAccList(this.$route.query.id); //获取账户
                // this.$router.push("/merchant/childManagement");
              }
            });
        } else {
          return false;
        }
      });
    },
    openDia1(idx) {
      this.form2 = {
        alipay_charset: this.form2.alipay_charset,
        sign_type: this.form2.sign_type,
        ...this.channelInfo[this.curIdx].openList[idx].info,
        channel: this.channelInfo[this.curIdx].channel,
        cType: this.channelInfo[this.curIdx].openList[idx].type,
        //后台需要参数
        combineTypes: this.channelInfo[this.curIdx].openList[idx].combineTypes,
      };
      this.curCtype = this.channelInfo[this.curIdx].openList[idx].type;
      this.curChannel1 = this.channelInfo[this.curIdx].channel;
      this.curChannel1Name = this.channelInfo[this.curIdx].openList[idx].name;
      this.curV2key =
        this.channelInfo[this.curIdx].openList[
          idx
        ].info.wechat_v2_rsa_public_key;
      this.curV2keyType = this.channelInfo[this.curIdx].openList[idx].type;
      this.cover = this.channelInfo[this.curIdx].openList[idx].info?.cert_id;
      this.form2.cover =
        this.channelInfo[this.curIdx].openList[idx].info?.cert_id;

      // this.certId = this.channelInfo[this.curIdx].openList[idx].info?.cert_id;
      // console.log(this.certId);
      this.chaDialog = true;
    },
    cencelReset1() {
      // this.paymentDocuments = [];
      this.paymentDocuments1 = [];
      this.form2.paymentDocuments1 = [];

      this.$refs.form2.resetFields(); //重置状态
      this.form2 = {
        alipay_charset: "UTF-8",
        sign_type: "RSA2",
        // refund: "0",
        // stream: "0",
      }; //动态弹窗
      this.chaDialog = false;
      this.getChannelList(this.$route.query.id); //获取渠道
    },
    cencelReset2() {
      this.$refs.form3.resetFields(); //重置状态
      // this.form3 = {}; //动态弹窗
      this.storeDialog = false;
    },
    cencelReset3() {
      // this.$refs.form2.resetFields(); //重置状态
      // this.form2 = {
      //   alipay_charset: "UTF-8",
      //   sign_type: "RSA2",
      //   refund: "0",
      //   stream: "0",
      // }; //动态弹窗
      this.paramType = 1;
      this.paramDialog = false;
    },
    handleSubmit1() {
      this.$refs.form2.validate((valid) => {
        if (valid) {
          if (getUserInfo().checkFlag) {
            this.handleSubmit11();
          } else {
            this.codeType = "SMS_BUSINESS_EDIT_SUB_CHANNEL_PARAM";
            this.codeDialog = true;
          }
        } else {
          return false;
        }
      });
    },
    handleSubmit11() {
      var info = {};
      switch (this.curCtype) {
        case "ali_site_pay":
        case "ali_lite_pay":
        case "ali_face_pay":
        case "ali_wap_pay":
        case "ali_app_pay":
        case "ali_pub_pay":
          info.rate = this.form2.rate;
          info.alipay_charset = this.form2.alipay_charset;
          info.sign_type = this.form2.sign_type;
          info.app_id = this.form2.app_id;
          info.alipay_public_key = this.form2.alipay_public_key;
          info.merchant_private_key = this.form2.merchant_private_key;
          // info.refund = this.form2.refund;
          break;
        case "ada_all_pay":
          info.app_id = this.form2.app_id;
          info.api_key = this.form2.api_key;
          info.api_mock_key = this.form2.api_mock_key;
          info.rsa_private_key = this.form2.rsa_private_key;
          info.merchant_public_key = this.form2.merchant_public_key;

          info.wechat_app_id = this.form2.wechat_app_id;
          info.wechat_app_secret = this.form2.wechat_app_secret;
          break;
        case "yse_all_pay":
          info.rate = this.form2.rate;
          info.partner_id = this.form2.partner_id;
          info.password = this.form2.password;
          info.private_key = this.form2.private_key;
          info.public_key = this.form2.public_key;
          break;
        case "douyin_all_pay":
          info.rate = this.form2.rate;
          info.app_id = this.form2.app_id;
          info.member_uid = this.form2.member_uid;
          info.private_key = this.form2.private_key;
          info.douyin_public_key = this.form2.douyin_public_key;
          info.secret = this.form2.secret;
          info.salt = this.form2.salt;
          info.token = this.form2.token;
          break;
        case "wechat_lite_pay":
        case "wechat_jsapi_pay":
        case "wechat_app_pay":
        case "wechat_wap_pay":
        case "wechat_native_pay":
          info.rate = this.form2.rate;
          info.app_id = this.form2.app_id;
          info.mchid = this.form2.mchid;
          info.app_secret = this.form2.app_secret;
          info.merchant_private_key = this.form2.merchant_private_key;
          // info.wechat_public_key = this.form2.wechat_public_key;
          // info.refund = this.form2.refund;
          // info.stream = this.form2.stream;
          info.mer_serial_no = this.form2.mer_serial_no;
          info.api_v3_key = this.form2.api_v3_key;
          info.api_v2_key = this.form2.api_v2_key;
          // info.wechat_serial_no = this.form2.wechat_serial_no;
          break;
        case "ali_business":
          info.rate = this.form2.rate;
          info.alipay_charset = this.form2.alipay_charset;
          info.sign_type = this.form2.sign_type;
          info.app_id = this.form2.app_id;
          info.merchant_public_key = this.form2.merchant_public_key;
          info.merchant_private_key = this.form2.merchant_private_key;
          info.rsa_public_key = this.form2.rsa_public_key;
          info.merchant_root_public_key = this.form2.merchant_root_public_key;
          // info.refund = this.form2.refund;
          break;
        case "online_banking":
        case "gateway_pay":
        case "online_cash":
        case "union_qr_pay":
          info.rate = this.form2.rate;
          info.mer_id = this.form2.mer_id;
          info.middle_cert = this.form2.middle_cert;
          info.root_cert = this.form2.root_cert;
          break;
        case "unified_pay":
          info.rate = this.form2.rate;
          info.mer_id = this.form2.mer_id;
          info.middle_cert = this.form2.middle_cert;
          info.root_cert = this.form2.root_cert;
          info.encrypt_cert = this.form2.encrypt_cert;
          info.pin_encrypt_cert = this.form2.pin_encrypt_cert;
          info.validate_public_cert = this.form2.validate_public_cert;
          break;
        case "apple_pay":
          info.rate = this.form2.rate;
          info.mer_id = this.form2.mer_id;
          info.middle_cert = this.form2.middle_cert;
          info.root_cert = this.form2.root_cert;
          info.minimum_rate = this.form2.minimum_rate;
          info.debit_card_rate = this.form2.debit_card_rate;
          info.apple_mer_id = this.form2.apple_mer_id;
          break;
        default:
          break;
      }
      let param = {
        // ...this.form2,
        channel: this.form2.channel,
        cType: this.form2.cType,
        //后台需要参数
        combineTypes: this.form2.combineTypes,
        memberId: this.$route.query.id,
        info,
      };
      //console.log(param);
      this.$http
        .post(`/api/sub/member/base/channel/param/update`, param)
        .then((res) => {
          if (res.code === "0000") {
            this.$message.success(res.msg);
            this.cencelReset1();
            this.getChannelList(this.$route.query.id); //获取渠道
          }
        });
    },
    handleSubmit2() {
      this.$refs.form3.validate((valid) => {
        if (valid) {
          let param = {
            extra: {
              ...this.form3,
              businessScope:
                this.form3.category_1_name + " " + this.form3.category_2_name,
              legalCertIdExpires: this.form3.legalCertIdExpires[1],
              socialCreditCodeExpires: this.form3.socialCreditCodeExpires[1],
            },
            member_id: this.memberId,
          };
          //console.log(param);
          this.$http
            .post("/api/thirdpart/adamember/create", param)
            .then((res) => {
              if (res.code === "0000") {
                this.$message.success(res.msg);
                // this.form3 = {};
                this.$refs.form3.resetFields(); //重置状态
                this.storeDialog = false;
              }
            });
        } else {
          return false;
        }
      });
    },
    handleSubmit3() {
      // var params = new FormData();
      let params = {};
      if (this.paramType == 1) {
        // params.append("memberId", this.memberId);
        params = {
          memberId: this.memberId,
        };
        this.$http
          .post("/api/developparam/updateTestSecret", params)
          .then((res) => {
            if (res.code === "0000") {
              this.cencelReset3();
              this.$message.success(res.msg);
              this.getParamsInfo(this.memberId);
            }
          });
      } else if (this.paramType == 2) {
        // params.append("memberId", this.memberId);
        params = {
          memberId: this.memberId,
        };
        this.$http
          .post("/api/developparam/updateLiveSecret", params)
          .then((res) => {
            if (res.code === "0000") {
              this.cencelReset3();
              this.$message.success(res.msg);
              this.getParamsInfo(this.memberId);
            }
          });
      } else {
        this.$refs.form4.validate((valid) => {
          if (valid) {
            // var params = new FormData();
            // params.append("memberId", this.memberId);
            // params.append("secret", this.form4.merchantPublicKey);
            params = {
              memberId: this.memberId,
              secret: this.form4.merchantPublicKey,
            };
            this.$http
              .post("/api/developparam/updateMerchantPublicKey", params)
              .then((res) => {
                if (res.code === "0000") {
                  this.cencelReset3();
                  this.$message.success(res.msg);
                  this.getParamsInfo(this.memberId);
                }
              });
          } else {
            return false;
          }
        });
      }
    },
    changeTab(idx) {
      this.curIdx = idx;
      this.curChannel1 = this.channelInfo[idx].channel;
    },
    submit() {
      this.$refs.form5.validate((valid) => {
        if (valid) {
          //console.log(this.form);
          this.$http
            .post(`/api/merchant/memberbase/edit`, {
              id: this.$route.query.id,
              memberName: this.form.memberName,
              remark: this.form.remark,
              refundFlag: this.form.refundFlag ? true : false,
              email: this.form.email,
              inviteStatus: this.form.inviteStatus,
            })
            .then((res) => {
              if (res.code === "0000") {
                this.$message.success("编辑成功！");
                this.testCancel();
              }
            });
        } else {
          return false;
        }
      });
    },
    testCancel() {
      this.$store.commit("changeLive", false);
      setTimeout(() => {
        this.$store.commit("changeLive", true);
      }, 0);
      this.$backTo("/merchant/childManagement");
    },
    changeType(idx) {
      this.storeTabIdx = idx;
    },
    goBack() {
      this.$backTo(`/merchant/childMerchantInfo?id=${this.$route.query.id}`);
    },
  },
};
</script>

<style lang="scss" scoped>
$-padding-left: 70px;
.drawer_footer {
  margin-top: 40px;
  padding: 0 75px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  .clear {
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #03bfc6;
    cursor: pointer;
  }
}

.drawer-wrapper {
  overflow: hidden;
  height: calc(100vh - 52px);
  :deep(.el-form-item__error) {
    position: relative;
  }
  .addTitle {
    padding: 0 75px;
    font-size: 24px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #1d1c1c;

    display: flex;
    justify-content: space-between;
  }
  .formWrap {
    padding: 0 75px;
    height: calc(100vh - 200px);
    overflow: auto;
  }
}

.mb20 {
  margin-bottom: 20px;
}
.mb40 {
  margin-bottom: 40px;
}

// .width120 {
//   width: 120px;
// }
.width134 {
  width: 134px;
}
.tipV2 {
  display: inline-block;
  color: #03bfc6;
  margin-bottom: 10px;
}
.tip {
  font-size: 14px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.65);
  margin-top: -12px;
  margin-bottom: 30px;
  &.tip1 {
    font-size: 12px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #869daa;
    margin-bottom: 12px;
  }
  a {
    text-decoration: none;
    font-size: 12px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #869daa;
  }
}
.cardNumber {
  margin-top: 32px;
}
.card-wrapper {
  display: flex;
}
.store-type-tab {
  display: flex;
  .tab-item {
    padding: 6px 42px;
    background: #f0f0f0;
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #4f595f;
    cursor: pointer;
    &:nth-of-type(1) {
      border-radius: 4px 0px 0px 4px;
    }
    &:nth-of-type(2) {
      border-radius: 0px 4px 5px 0px;
    }
    &.active {
      background: #03bfc6;
      color: #ffffff;
    }
  }
}

.titleCommand {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 35px;
  margin-top: 18px;
  .l {
    font-size: 24px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #1d1c1c;
  }
}

.box {
  margin-bottom: 10px;
}

.basic,
.account,
.payment {
  padding: 5px 20px 10px 20px;
  .top {
    display: flex;
    align-items: center;
    .title {
      font-size: 18px;
      font-family: PingFangSC-Semibold, PingFang SC;
      font-weight: 600;
      color: #4f595f;
      margin-right: 35px;
    }
  }
  .bottom {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    .item {
      width: 33.3%;
    }
  }
}

.payment {
  .channel {
    display: flex;
    align-items: center;
    .l {
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #666666;
      // width: 90px;
      padding-right: 20px;
    }
    .r {
      span {
        display: inline-block;
        margin-right: 20px;
        font-size: 14px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #03bfc6;
        cursor: pointer;
      }
    }
  }
}

.channel {
  padding: 5px 20px 10px 20px;
  .top {
    display: flex;
    align-items: center;
    .title {
      font-size: 18px;
      font-family: PingFangSC-Semibold, PingFang SC;
      font-weight: 600;
      color: #4f595f;
      margin-right: 35px;
    }
  }

  .bottom {
    margin-top: 20px;
    .nav-tab {
      display: flex;
      margin-bottom: 14px;
      .tab-item {
        width: 185px;
        padding: 9px 27px;
        text-align: center;
        font-size: 16px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: rgba(0, 0, 0, 0.65);
        border-top: 2px solid transparent;
        cursor: pointer;

        &.active {
          color: #03bfc6;
          border-top: 2px solid #03bfc6;
        }
      }
    }
    .nav-list {
      display: flex;
      flex-wrap: wrap;
      .list-item {
        width: 23.5%;
        min-width: 300px;
        height: 174px;
        background: #ffffff;
        border-radius: 10px;
        border: 1px solid #d8d8d8;
        padding: 30px;
        margin-right: 20px;
        margin-bottom: 20px;
        .tit {
          font-size: 16px;
          font-family: PingFangSC-Medium, PingFang SC;
          font-weight: 500;
          color: #1d1c1c;
          margin-bottom: 12px;
        }
        .desc {
          font-size: 14px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: #666666;
          min-height: 38px;
        }
        .btn {
          margin-top: 25px;
        }
      }
    }
  }
}

.cardDialog {
  background: transparent !important;
  box-shadow: none !important;
  .addTitle {
    font-size: 20px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: bold;
    color: rgba(0, 0, 0, 0.85);
  }
  .tip {
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: rgba(0, 0, 0, 0.65);
    margin-top: 12px;
    margin-bottom: 30px;
    &.tip1 {
      font-size: 12px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #869daa;
      margin-bottom: 12px;
    }
    a {
      text-decoration: none;
      font-size: 12px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #869daa;
    }
  }
  :deep(.el-dialog) {
    border-radius: 16px;
  }
  :deep(.el-dialog__body) {
    padding: 10px 41px 40px 40px;
    padding-bottom: 98px;
    background: #fff;
    border-radius: 16px;
    margin-bottom: -82px;
  }
  .dialog-footer {
    margin-right: 22px;
  }
  // :deep(.el-button--small) {
  //   width: 74px;
  // }
  // :deep(.el-input__inner) {
  //   padding-left: 40px;
  // }
  :deep(.el-form-item__content) {
    position: relative;
  }
  .form-img {
    width: 22px;
    border-radius: 22px;
    position: absolute;
    top: 5px;
    left: 10px;
    z-index: 1;
  }
}

.pageW {
  .wrap {
    background: #fff;
    margin-top: 20px;
    padding-bottom: 40px;
    .title {
      font-size: 24px;
      font-weight: 500;
      height: 40px;
      line-height: 40px;
      color: #25b5d9;

      position: relative;
      &::before {
        content: "";
        width: 95px;
        height: 10px;
        background: #25b5d9;
        border-radius: 5px;
        position: absolute;
        top: 55px;
      }
    }
    .header {
      display: flex;
      justify-content: space-between;
      padding: 20px 40px 20px 70px;
      border-bottom: 1px solid #f0f0f0;
    }
    .secTitle {
      padding-left: 38px;
      font-weight: 600;
      color: #4f595f;
      font-size: 20px;
    }
    .el-form-item {
      padding-left: $-padding-left;
    }
    .cardNum {
      font-weight: 500;
      color: #1d1c1c;
      font-size: 14px;
      margin-right: 180px;
    }
    .typeText {
      display: inline-block;
      width: 162px;
      color: #1d1c1c;
      font-size: 14px;
      font-weight: 400;
    }
    .typeBox {
      padding-left: $-padding-left;
      span {
        display: inline-block;
        width: 110px;
        height: 48px;
        line-height: 48px;
        color: #869daa;
        background: #f4f8fb;
        text-align: center;
        border-radius: 4px 4px 0px 0px;
        cursor: pointer;
        &:nth-child(2) {
          margin: 0 2px;
        }
      }
      .active {
        color: #fff;
        background: #03bfc6;
      }
    }
    .fillParams {
      display: flex;
      justify-content: space-between;
      padding-left: $-padding-left;
      width: 700px;
      margin-top: 34px;
      .fillText {
        font-weight: 500;
        color: #4f595f;
        line-height: 25px;
      }
      .fillSecText {
        font-weight: 400;
        color: #869daa;
        font-size: 12px;
        margin-top: 12px;
        margin-bottom: 26px;
      }
    }
    .tooltipIcon {
      font-size: 16px;
      margin-right: 34px;
      color: #869daa;
    }
    ._posi {
      position: relative;
      top: -54px;
    }
    .change {
      width: 130px;
      position: relative;
      top: 70px;
      left: -130px;
    }
    .btnIcon {
      width: 120px;
    }
  }
  .pageTwo {
    display: flex;
    justify-content: space-between;
    .pageTwoLeft {
      width: 65%;
      .el-form-item {
        padding-left: 40px;
      }
    }

    .hintBox {
      flex: 1;
      padding-left: 53px;
      background: #f9f9f9;
      color: #bfbfbf;
      font-weight: 400;
      color: #bfbfbf;
      line-height: 24px;
      .s_title {
        color: #666;
        font-weight: 500;
        margin-bottom: 5px;
      }
    }
  }
  :deep(
      input[type="number"]::-webkit-inner-spin-button,
      input[type="number"]::-webkit-outer-spin-button
    ) {
    -webkit-appearance: none;
    margin: 0;
  }
}

.param-item {
  width: 100%;
  margin-bottom: 25px;
  .tit {
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #666666;
    margin-bottom: 10px;
  }
  .com {
    display: flex;
  }
  &.noInput {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
}
:deep(.el-upload-list) {
  width: 100%;
}
</style>
